const fs = require('fs')
const { myConsole, logRed } = require('./utils')

function writeResult(logPath, logName, result) {
	let timestamp = +new Date()
	let filePath = `${logPath}${logName}-${timestamp}.js`
	fs.writeFile(filePath, result, (err) => {
		if (err) {
            return logRed(`【文件写入错误】===> ${err}`)
		}
		myConsole('blueBG',`【日志写入完毕√】===> ${filePath}`)
	})
}
module.exports = {
	writeResult,
}
